#include <stdio.h>
#include <stdlib.h>
#include <errno.h> 
int main(void)
{
	FILE* source;
	errno_t err;
	FILE* putin;
	errno_t err1;
	char ch;
	if ((err = fopen_s(&source,"testout.txt", "r+")) != 0)
	{
		printf("testout open failed! %d.\n", errno);
		exit(EXIT_FAILURE);
	}
	else
	{
		printf("test out open success!\n");
	}
	if ((err1 = fopen_s(&putin, "testin.txt", "w+")) != 0)
	{
		printf("testin open failed! %d.\n", errno);
		exit(EXIT_FAILURE);
	}
	else
	{
		printf("testin open success!\n");
	}
	while ((ch = getc(source)) != EOF)
	{
		putc(ch, putin);
	}
	if (fclose(source) != 0)//如果成功返回0
	{
		printf("source close error");
	}
	if (fclose(putin) != 0)//如果成功返回0
	{
		printf("putin close error");
	}
    return 0;
}